#!/bin/bash

mkdir -p /etc/systemd/system/docker.service.d

echo "[Service]" >> /etc/systemd/system/docker.service.d/proxy.conf
echo "Environment=\"HTTP_PROXY=http://127.0.0.1:7897/\"" >> /etc/systemd/system/docker.service.d/proxy.conf
echo "Environment=\"HTTPS_PROXY=http://127.0.0.1:7897/\"" >> /etc/systemd/system/docker.service.d/proxy.conf
echo "Environment=\"NO_PROXY=localhost,127.0.0.1,.example.com\"" >> /etc/systemd/system/docker.service.d/proxy.conf

systemctl daemon-reload
systemctl restart docker